Repository navigation
feat(vanilla): add bundled build strategy to reduce MultiCompiler fan-out - #54
Merged
Merged
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
Release v2.5.0: add an opt-in
strategy: 'bundled'option togetVanillaConfig, bundled entry-key modes for consumer-facing output paths, andrunWebpackConfigsfor concurrency-limited builds.Why?
The legacy per-file vanilla strategy creates one webpack config per source file per variant (4 × file count). webpack-cli runs these via MultiCompiler in parallel, which drove high peak memory and slow builds in Polylang Pro before glob fixes — and remains a bottleneck for any consumer with many vanilla assets.
Polylang-family plugins enqueue flat build URLs (
js/build/settings.min.js). Bundled builds default to the same flat layout as per-file (entryKey: 'basename'), so consumers need not passentryKeyor maintain local webpack hacks.How?
strategy: 'bundled'(default remains'per-file'): emits up to 4 configs — JS min/unmin + CSS min/unmin — using multi-entry webpack configs. Invalidstrategyvalues throw (no silent fallback to per-file).entryKey(bundled only):'basename'(default) for flatjs/build/{name}paths, or'relative'for nested outputs mirroring source paths. Duplicate basenames in one bundled config throw at config generation time.createBundledJsConfig/createBundledCssConfig: collision-safe entry maps;splitChunks/runtimeChunkdisabled so each entry stays one file; bundled CSS scopesCleanWebpackPluginto the output directory..min.work/.unmin.workfiles so bundled (and per-file) CSS min + unmin can run in parallel without racing on the same paths. Per-file CSS cleanup is scoped to the output directory instead ofprocess.cwd().runWebpackConfigs(configs, { concurrency }):TypeErrorfor non-array configs or invalid concurrency; fail-fast on first compilation error;Infinityconcurrency still supported.Versioning
@wpsyntex/polylang-build-scriptsto 2.5.0 (minor): new public APIs plus CSS intermediate filename and clean-scope changes that apply to all vanilla strategies (not onlybundled).Test plan
npm test(77 tests)npm run lintentryKey: 'relative'), default flat JS/CSS, parallel bundled CSS min/unmin, no extra chunks with shared local importsstrategy: 'bundled'only (~6 total configs instead of ~54)